<?php

/**
 * O2O团购PC版本
 * ============================================================================
 * * 版权所有 2009-2016 郑州司科计算机科技有限公司，并保留所有权利。
 * 购买网址: http://www.jzphp.com；
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和
 * 使用；不允许对程序代码以任何形式任何目的的再发布。
  * 咨询电话：400-823-0371 QQ：313999875
 * ============================================================================
 * $Author: zzsike $
 * $Time 2016-02-03 sammy $
*/


require_once(dirname(dirname(__FILE__)) . '/appwap.php');

$daytime = time();
$condition = array(
'team_type' => 'normal',
	'daohang' => '300',
		"begin_time <  {$daytime}",
		"end_time > {$daytime}",
		);
$group_id = abs(intval($_GET['gid']));
if ($group_id) $condition['group_id'] = $group_id;
$count = Table::Count('team', $condition);
list($pagesize, $offset, $pagestring) = pagestring($count, 18, true);
$teams = DB::LimitQuery('team', array(
			'condition' => $condition,
			'order' => 'ORDER BY begin_time DESC, sort_order DESC, id DESC',
			'size' => $pagesize,
			'offset' => $offset,
			));
//foreach($teams AS $id=>$one){
//	team_state($one);
//	if ($one['state']=='none') $one['picclass'] = 'isopen';
//	if ($one['state']=='soldout') $one['picclass'] = 'soldout';
//	$teams[$id] = $one;
//}
$pagetitle='热销商城';
include template('wap_now');

function current_teamcategorys3($gid='0') {
	if($_GET[pri])
	$str='&pri='.$_GET[pri];
		$daytime = time();
$condition = array(
	'team_type' => 'normal',

	"begin_time <= '{$daytime}'",
	"end_time >= '{$daytime}'",
);

	$a = array('/wap/current.php' => '全部',

			);
	foreach(option_hotcategory('group') AS $id=>$name) {
	$condition['group_id'] = $id;
	  $num= Table::Count('team', $condition);
		$a["/wap/current.php?gid=$id".$str] = $name.'('.$num.')';
	}

	$l = "/wap/current.php?gid=$gid".$str;
	if (!$gid) $l = "/wap/current.php";
	return current_link($l, $a, true);
}
